<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<?php
    session_start();
    include("../Service/WebClass/timer/CampaignTimerService.php");
    $campaignTimer = new CampaignTimerService();

    if($_POST['option'] == "delete")
    {
        if($campaignTimer->deleteTimer($_POST['checkedIds']))
        {
            $message = "削除しました。";
        }
        else
        {
            $message = "削除失敗しました。";
        }
        echo "<script language='javascript'>alert(\"".$message."\");</script>";
    }
?>
<title>タイマー設定</title>
<link rel="stylesheet" href="../css/common.css" type="text/css" />
<script language="JavaScript" src="../js/common.js" type="text/javascript"></script>
<meta http-equiv="Pragma" content="cache">
<meta http-equiv="Cache-Control" content="cache">
<script type="text/javascript">
<!--
// タイマー入札
	function editTimer(time_id)
        {
		window.open('../timer/CampaignTimerEdit.php?listingType=<?php echo $_GET['listingType']; ?>&camp_Id=<?php echo $_GET['camp_Id']; ?>&timerId=' + time_id);
	}

	function newTimer()
        {
		window.open('../timer/CampaignTimerNew.php?listingType=<?php echo $_GET['listingType']; ?>&camp_Id=<?php echo $_GET['camp_Id']; ?>');
	}
    function do_refresh()
    {
        document.mainform.option.value = "search";
        document.mainform.submit();
    }

    function do_delete()
    {
        var isCheck = false;
        var timers = document.getElementsByName("timerCheck");
        var Ids = "-1";

        for(var i=0; i< timers.length; i++)
        {
            if(timers[i].checked == true)
            {
                Ids = Ids + "," + timers[i].value;
                isCheck = true;
            }
        }
        if(isCheck)
        {
            document.mainform.checkedIds.value = Ids;
            document.mainform.option.value = "delete";
            document.mainform.submit();
        }
        else
        {
            alert("タイマーを選択してください。");
        }
    }
    -->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="logo" id="topmenu">
	<tr>
		<td width="200" valign="top">&nbsp;</td>
		<td align="right" valign="top">
			<br>
			<input type="button" class="btn close" onClick="self.close();">
		</td>
 	</tr>
</table>

<form name="mainform" method="post">
<br><b><?php echo "レポート ＞ [媒体]$campaignTimer->listingName ＞ [キャンペーン]$campaignTimer->campaignName ＞ タイマー設定"; ?></b>
<input type="hidden" name="option" value=""/>
<input type="hidden" name="checkedIds" value="" />
<table width="100%" border="0" cellpadding="2" cellspacing="0">
	<tr>
		<td align="left">
		</td>
		<td align="right">
			<input type="button" class="btn new" onClick="newTimer();">
			<input type="button" class="btn del" onClick="do_delete();">
			<input type="button" value="" class="btn refresh" onClick="do_refresh();" >
		</td>
	</tr>
</table>

<table width="100%" border="0" cellpadding="4" cellspacing="0" class="tbl">
	<tr align="center" class="tr2">
		<td width="40" align="center">No</td>
		<td width="20"></td>
		<td width="60" align="center">実行</td>
		<td width="80" align="center">日</td>
		<td width="80" align="center">時間</td>
		<td align="left">内容</td>
		<td width="40" align="center">
			<input type="checkbox" onClick="check_all(this.checked, 'timerCheck')">
		</td>
	</tr>
	<?php echo $campaignTimer->searchTimer(); ?>
</table>

<table width="100%" border="0" cellpadding="2" cellspacing="0">
	<tr>
		<td align="left"></td>
		<td align="right"><?php if($campaignTimer->count == 0) echo 0;else echo 1; ?>件-<?php echo $campaignTimer->count; ?>件/ <?php echo $campaignTimer->count; ?>件&nbsp;&nbsp;</td>
	</tr>
</table>
</form>
</body>
</html>